#include <iostream>
using namespace std;

class Animal
{
public:
	Animal(int _age):age(_age)
	{
		weight=5.6;
		cout<<"构造函数的参数列表"<<endl;
	}
	/* void setAge(int newage)
	{
		age=newage; //错误的，原因是age是常量，不能修改
	} */
	int setWeight(float newweight) const  //注意const修饰成员方法，const写在后面
	{
		//weight=15.5;  //const修饰的成员方法不能修改任何变量的值
		//name="xiaohuang"; //const修饰的成员方法不能修改任何变量的值
		cout<<"weight "<<weight<<endl;
	}
	void show() 
	{
		cout<<"age:  "<<age<<endl;
	}
private:
	const int age;
	float weight;
	string name;
};

int main()
{
	Animal a(8);
	a.show();
	a.setWeight(2.3);
	//修改age的值
	//a.setAge(18);
	//a.show();
}
